package com.winshare.saleAssistant.dao;

import com.winshare.saleAssistant.domain.entity.ProductDO;
import com.winshare.saleAssistant.domain.entity.ProductModuleContentDO;
import com.winshare.saleAssistant.domain.query.ProductPreviewQuery;
import com.winshare.saleAssistant.domain.query.ProductQuery;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
@Component
public interface ProductMapper {

    int saveProduct(ProductDO productDO);

    int countByProductCategoryAndName(ProductDO productDO);

    int updateProduct(ProductDO productDO);

    int deleteProduct(ProductDO productDO);

    int queryProductCount(ProductQuery productQuery);

    List<ProductDO> findProductListByConditions(ProductQuery productQuery);

    ProductDO getProduct(ProductDO productDO);

    int deleteProductModuleContent(@Param("productDO")ProductDO productDO, @Param("pattern") Integer pattern);

    int batchInsertProductModuleContent(@Param("productModuleContentDOList")
                                                List<ProductModuleContentDO> productModuleContentDOList);

    List<ProductModuleContentDO> getProductModuleContent(ProductPreviewQuery productPreviewQuery);

    List<ProductModuleContentDO> getProductModuleContentByConditions(@Param("id") Integer id,
                         @Param("productCategoryId") Integer productCategoryId,
                         @Param("moduleIdList") List<Integer> moduleIdList,@Param("pattern") Integer pattern);

    int addReadCount(ProductDO productDO);

    void addPromotionTimes(ProductDO productDO);
}
